package com.hxhy.util;

import javax.annotation.Resource;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Repository;

import com.hxhy.service.InvoiceService;
import com.hxhy.service.InvoiceServiceImpl3;

@Repository
public class Job {

	@Resource(name = "${version}")
	InvoiceService service;
	
	@Scheduled(fixedDelay = 2*60*1000)
	public void autoKP() {
		try {
			service.kp();
			Thread.sleep(20000);
			service.searchInvoice();
		} catch (Exception e) {
		}
	}
	
	/**
	 * @抚松版本(刷新身份令牌)
	 */
	@Scheduled(fixedDelay = 20*60*60*1000)
	public void reflushToken() {
		if(service instanceof InvoiceServiceImpl3)
			((InvoiceServiceImpl3) service).token();
	}
	
}
